cmake_minimum_required(VERSION 3.0 )

project(YoloLearn)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

#onnxruntime providers
# option(onnxruntime_USE_CUDA "Build with CUDA support" OFF)
# option(onnxruntime_USE_TENSORRT "Build with TensorRT support" OFF)
# option(LIBPNG_ROOTDIR "libpng root dir")
# option(ONNXRUNTIME_ROOTDIR "onnxruntime root dir")

# if(NOT ONNXRUNTIME_ROOTDIR)
#   if(WIN32)
#     set(ONNXRUNTIME_ROOTDIR "C:/Program Files/onnxruntime")
# else()
#     set(ONNXRUNTIME_ROOTDIR "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/onnxruntime")
#   endif()
# endif()

# if(onnxruntime_USE_CUDA)
#   add_definitions(-DUSE_CUDA)
# endif()
# if(onnxruntime_USE_TENSORRT)
#   add_definitions(-DUSE_TENSORRT)
# endif()
# if(onnxruntime_USE_DML)
#   message("Enabling DML")
#   add_definitions(-DUSE_DML)
# endif()

find_package(OpenCV REQUIRED)
# find_package(onnxruntime REQUIRED)
# 打印OpenCV的路径
message(STATUS "OpenCV_DIR: ${OpenCV_DIR}")

file(GLOB_RECURSE SRC_FILES src/*.cpp)

include_directories(
    ${OpenCV_INCLUDE_DIRS}
    ${PROJECT_SOURCE_DIR}/include
    # ${ONNXRUNTIME_ROOTDIR}/include
)

#

# 添加动态库的搜索路径
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "/usr")

add_executable(${PROJECT_NAME} ${SRC_FILES})

target_link_libraries(${PROJECT_NAME}  
    ${OpenCV_LIBS}
    # onnxruntime::onnxruntime
)
#/home/lixinlong/Project/yolo-learn/thirdparty/onnxruntime/lib/libonnxruntime.so.1.20.1
install(
    TARGETS ${PROJECT_NAME}
    RUNTIME DESTINATION bin
    LIBRARY DESTINATION lib
    ARCHIVE DESTINATION lib
)
